/*
 * Copyright 2010 Christoph Widulle (christoph.widulle@googlemail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */



package com.android1.amarena2d.commons;

import com.badlogic.gdx.graphics.GL10;

public class BlendFunction {

    String name;

    public int src;
    public int dst;

    public BlendFunction(int s, int d) {
        src = s;
        dst = d;
    }

    public BlendFunction(int src, int dst, String name) {
        this.src = src;
        this.dst = dst;
        this.name = name;
    }

    public boolean isDefault() {
        return this.equals(DEFAULT);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BlendFunction that = (BlendFunction) o;

        if (dst != that.dst) return false;
        if (src != that.src) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = src;
        result = 31 * result + dst;
        return result;
    }

    public static final BlendFunction DEFAULT = new BlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA, "DEFAULT");
    public static final BlendFunction TEXT = new BlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA, "TEXT");
    public static final BlendFunction ADDITIVE_BLEND = new BlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE, "ADDITIVE_BLEND");
    public static final BlendFunction ADDITIVE_BLEND2 = new BlendFunction(GL10.GL_ONE, GL10.GL_ONE, "ADDITIVE_BLEND2");
}
